Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


Invoking methods

You can invoke a method defined or inherited within a class simply by naming it and, if it returns as value, by including it in an expression, much as with a user-defined function. You can invoke a public method defined in another object (outside the running class hierarchy) in a similar fashion, except that you must prefix the method name with a reference to the other object instance separated by a colon (:). Invoking a method on (defined in) another object is analogous to invoking a built-in method on a 4GL system or object handle.

Comparison with procedure-based programming

When you invoke an internal procedure from within an external procedure where it is defined, you use a RUN statement that simply names the procedure. When you invoke a user-defined function within an external procedure where it is defined, you name the function in an expression, similar to invoking a method within a class. However, you have to forward reference the definition for the user-defined function if it occurs after the point of invocation.

When you invoke an internal procedure defined in another external procedure, you use the RUN statement with an IN option to specify the location of the internal procedure definition. When you invoke a user-defined function defined in another external procedure, you must specify the prototype and reference the location of the function definition, then invoke the function by naming it in an expression.

Method invocation within its defining class or on an another object instance is far more consistent than for internal procedures and user-defined functions.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095